﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;

using IBApi;

namespace IBRx {
	public class OrderBase : IBResponse { }

	public class NextValidId : OrderBase {
		public int OrderId { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public NextValidId(int orderId) {
			this.OrderId = orderId;
		}
	}

	public class OrderStatus : OrderBase {
		public int OrderId { get; private set; }
		public string Status { get; private set; }
		public int Filled { get; private set; }
		public int Remaining { get; private set; }
		public double AvgFillPrice { get; private set; }
		public int PermId { get; private set; }
		public int ParentId { get; private set; }
		public double LastFillPrice { get; private set; }
		public int ClientId { get; private set; }
		public string WhyHeld { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public OrderStatus(int orderId, string status, int filled, int remaining, double avgFillPrice, int permId, int parentId, double lastFillPrice, int clientId, string whyHeld) {
			this.OrderId = orderId;
			this.Status = status;
			this.Filled = filled;
			this.Remaining = remaining;
			this.AvgFillPrice = avgFillPrice;
			this.PermId = permId;
			this.ParentId = parentId;
			this.LastFillPrice = lastFillPrice;
			this.ClientId = clientId;
			this.WhyHeld = whyHeld;
		}
	}

	public class OpenOrder : OrderBase {
		public int OrderId { get; private set; }
		public Contract Contract { get; private set; }
		public Order Order { get; private set; }
		public OrderState OrderState { get; private set; }

		[MethodImplAttribute(MethodImplOptions.AggressiveInlining)]
		public OpenOrder(int orderId, Contract contract, Order order, OrderState orderState) {
			this.OrderId = orderId;
			this.Contract = contract;
			this.Order = order;
			this.OrderState = orderState;
		}
	}

	public class OpenOrderEnd : OrderBase {
		public OpenOrderEnd() {}
	}
}
